<?php

class CPage {
	private static $_pageClassName = "";
	public static function setPageClass($clsName)
	{
		self::$_pageClassName = $clsName;
	}
	
	public static function showPage($curPage,$pageSize,$rowCount,$baseUrl="")
	{
		if(self::$_pageClassName)
		{
			$pageCls = self::$_pageClassName;
		}
		else{
			$pageCls = Config::get("page.class","CPageDefault");
		}
		
		if(class_exists($pageCls))
		{
			$obj = new $pageCls($baseUrl);
			//var_dump($obj instanceof CPageBase);
			if($obj instanceof CPageBase){
				return $obj->showPage($curPage,$pageSize,$rowCount);
			}
			else
			{
				CError::handler(E_ERROR,"类[".$pageCls."]必须继承自CPageBase",__FILE__,__LINE__);
			}
		}
		else
		{
			CError::handler(E_ERROR,"类[".$pageCls."]不存在",__FILE__,__LINE__);
		}
	}
}

?>